package cn.phecda.boot.tenant.test.table.mybatis;

import cn.phecda.boot.data.core.entity.DataStatus;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.concurrent.ThreadLocalRandom;

/**
 * <p> TODO </p>
 *
 * @author : wanpinwei
 */
public interface PersonTenantMybatisMapper extends BaseMapper<PersonTenantMybatisEntity> {
    default PersonTenantMybatisEntity named(String name) {
        PersonTenantMybatisEntity entity =  new PersonTenantMybatisEntity(name);

        ThreadLocalRandom random = ThreadLocalRandom.current();
        if (random.nextBoolean()) {
            entity.setReserved(true);
            entity.setDataStatus(DataStatus.DISABLE);
        }
        return entity;
    }
}
